<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
  </head>
  <body>
    <div>aaa</div>
    <script>
      //      一个对象有多少个属性是可以临时添加的
      let a = {};
      a.name = "zhangsan";
      a.age = 12;
      a.shout = function () {
        console.log(this.name + "======");
      };
      // JSON字面量
      let b = {
        name: "lisi",
        age: 13,
      };
      let s = JSON.stringify(b);
      //  JSON格式的字符串  JSON对象
      let c = JSON.parse(s);
      let d = JSON.parse(JSON.stringify(a));

      let e = {};

      class Person {
        constructor(name, age) {
          this.name = name;
          this.age = age;
        }
      }
      let person = new Person("zhangsan", 12);
      //  person 对象 继承于 Person类 Person类 继承于 Object类
      class Student extends Person {
        constructor(name, age, skill) {
          super(name, age);
          this.skill = skill;
        }
      }
      let student = new Student("lisi", 23, "basketball");
      let xiaoming = {
        money: 10,
      };
      // xiaoming.
      xiaoming.__proto__ = student.__proto__;

      class Some {
        constructor(name) {
          this.name = name;
          this.age = 10;
          this.shout = function () {
            console.log(this.name + " shout");
          };
        }
        run() {
          console.log(this.name + "run");
        }
        sex = true;
        run2 = function () {
          console.log(this.name + "run2");
        };
        run3 = function () {
          console.log(this.name + "run3");
        };
        static go() {
          console.log("some");
        }
      }
      let ww = new Some("wangwu");
      let zl = new Some("zhaoliu");

      //  古早时期js声明类
      function Any(name) {
        this.name = name;
        this.age = 10;
        this.shout = function () {
          console.log(this.name + " shout");
        };
      }
      Any.prototype.run = function () {
        console.log(this.name + "run");
      };
      let ls = new Any("lisi");
      // ls.run2=function () {
      //   console.log(this.name + "run2");
      // };

      let ls2 = {};
      ls2.__proto__ = Any.prototype;
      Any.call(ls2, "lisi2");

      let ls3 = Object.create(Any.prototype);
      Any.call(ls3, "lisi3");
    </script>
  </body>
</html>
